package com.example.attendance_back.mapper;

import com.example.attendance_back.model.Student;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface StudentMapper {

    @Select("select * from student")
    @Results(id = "studentMap",value = {
            @Result(column ="student_id",property ="studentId"
                    ,jdbcType = JdbcType.INTEGER,id = true),
            @Result(column = "name",property = "name")
    })
    List<Student> selectAll();


    @Select("select exists (select * from student where username=#{username} and password=#{password})")
    int exits(Student student);



    @Insert("insert into student(name) values(#{name})")
    int insert(Student student);


    @Select("select * from student where student_id=#{studentId}")
    Student selectById(Integer studentId);
}
